const RouteHistory = {
  state: {
    RouteHistory: [{ name: '首页', routeName: 'Homepage' }] // 路由历史记录列表
  },
  mutations: {
    // v: 添加的历史路由对象{ name: '', routeName: '' }
    AddRouteHistory (state, v) {
      if (state.RouteHistory.every(i => i.routeName !== v.routeName)) {
        state.RouteHistory.push(v)
      }
    },
    // v: 需要移除的路由名称routeName
    RemoveRouteHistory (state, v) {
      state.RouteHistory = state.RouteHistory.filter(i => i.routeName !== v)
    }
  }
}

export default RouteHistory
